<?php
	class khoadata
	{
		public function Them($MaKhoa = "", $TenKhoa = "")
		{
			$sql = "INSERT INTO khoa(khoa_ma, khoa_ten)
					VALUES('$MaKhoa', '$TenKhoa')";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($MaKhoa = "", $TenKhoa = "")
		{
			$sql = "UPDATE khoa SET khoa_ten = '$TenKhoa' WHERE khoa_ma = '$MaKhoa'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function Xoa($MaKhoa = "")
		{
			$sql = "DELETE  FROM khoa WHERE khoa_ma = '$MaKhoa'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach($MaKhoa = "")
		{
			$sql = "SELECT * FROM khoa WHERE 1";
			
			if($MaKhoa != "")
				$sql .= " AND khoa_ma = '$MaKhoa'";
			
			$service = new dataservice();
			return $service->ExecuteQuery($sql);
		}
	}
?>